import VueRouter from "vue-router";
import login from "../components/Login.vue";
import index from "../components/index.vue";
const routes=[
    {
        path:"/",
        name:"login",
        component:login
    },
    {
        path:"/index",
        name:"INdex",
        component:index,
        children:[
            {
                path:"/Home",
                name:"Home",
                meta:{
                    title:"首页"
                },
                component:()=>import("../components/Home.vue")
            },
            {
                path:"/UserMange/UserConsultant",
                name:"UserConsultant",
                meta:{
                    title:"咨询者"
                },
                component:()=>import("../components/UserMange/user.vue")
            },
            {
                path:"/UserMange/UserConselor",
                name:"UserConselor",
                meta:{
                    title:"咨询师"
                },
                component:()=>import("../components/UserMange/UserConselor.vue")
            },
            {
                path:"/UserMange/Manger",
                name:"Manger",
                meta:{
                    title:"管理员"
                },
                component:()=>import("../components/UserMange/Manger.vue")
            },
            {
                path:"/ConsultMange",
                name:"ConsultMange",
                meta:{
                    title:"咨询管理"
                },
                component:()=>import("../components/ConsultMange.vue")
            },
            {
                path:"/MessageMange",
                name:"MessageMange",
                meta:{
                    title:"资讯管理"
                },
                component:()=>import("../components/MessageMange.vue")
            },
            {
                path:"/text/:announcementId",
                name:"textEdit",
                meta:{
                    title:"文本编辑"
                },
                component:()=>import("../components/text/textEdit.vue")
            },
            {
                path:"/text1/:id",
                name:"text",
                meta:{
                    title:"文本查看"
                },
                component:()=>import("../components/text/text.vue")
            },
            {
                path:"/QuestionMange",
                name:"QuestionMange",
                meta:{
                    title:"问卷管理"
                },
                component:()=>import("../components/QuestionMange.vue")
            },
            {
                path:"/questionaire/:questionaireId",
                name:"questionaire",
                meta:{
                    title:"问卷问题管理"
                },
                component:()=>import("../components/questionaire/questionaire.vue")
            },
            
            {
                path:"/ServeyMange",
                name:"ServeyMange",
                meta:{
                    title:"心理问答管理"
                },
                component:()=>import("../components/ServeyMange.vue")
            }
        ]
    }
]
const router=new VueRouter({
    mode:"history",
    routes
})
const VueRouterPush=VueRouter.prototype.push;
VueRouter.prototype.push=function push(to){
    return VueRouterPush.call(this,to).catch(err=>err)
} 
export default router;
